home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / pdriver5.arc / DEFS.ASM < prev    next >
Assembly Source File  |  1989-12-17  |  4KB  |  101 lines

  1. majver        equ    5        ;version number of the infrastructure.
  2.  
  3. MAX_ADDR_LEN    equ    16        ;maximum number of bytes in our address.
  4.  
  5. MAX_HANDLE    equ    8        ;maximum number of handles.
  6.  
  7. MAX_P_LEN    equ    8        ;maximum type length
  8.  
  9. MAX_MULTICAST    equ    8        ;maximum number of multicast addresses.
  10.  
  11. ;  Copyright, 1988, 1989, Russell Nelson
  12.  
  13. ;   This program is free software; you can redistribute it and/or modify
  14. ;   it under the terms of the GNU General Public License as published by
  15. ;   the Free Software Foundation, version 1.
  16. ;
  17. ;   This program is distributed in the hope that it will be useful,
  18. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;   GNU General Public License for more details.
  21. ;
  22. ;   You should have received a copy of the GNU General Public License
  23. ;   along with this program; if not, write to the Free Software
  24. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26.     .286
  27.  
  28. HT    equ    09h
  29. CR    equ    0dh
  30. LF    equ    0ah
  31.  
  32. ;
  33. ;  Packet Driver Error numbers
  34. NO_ERROR    equ    0        ;no error at all.
  35. BAD_HANDLE    equ    1        ;invalid handle number
  36. NO_CLASS    equ    2        ;no interfaces of specified class found
  37. NO_TYPE        equ    3        ;no interfaces of specified type found
  38. NO_NUMBER    equ    4        ;no interfaces of specified number found
  39. BAD_TYPE    equ    5        ;bad packet type specified
  40. NO_MULTICAST    equ    6        ;this interface does not support
  41.                     ;multicast
  42. CANT_TERMINATE    equ    7        ;this packet driver cannot terminate
  43. BAD_MODE    equ    8        ;an invalid receiver mode was specified
  44. NO_SPACE    equ    9        ;operation failed because of
  45.                     ;insufficient space
  46. TYPE_INUSE    equ    10        ;the type had previously been accessed,
  47.                     ;and not released.
  48. BAD_COMMAND    equ    11        ;the command was out of range, or not
  49.                     ;implemented
  50. CANT_SEND    equ    12        ;the packet couldn't be sent (usually
  51.                     ;hardware error)
  52. CANT_SET    equ    13        ;hardware address couldn't be changed
  53.                     ;(more than 1 handle open)
  54. BAD_ADDRESS    equ    14        ;hardware address has bad length or
  55.                     ;format
  56.  
  57. ;a few useful Ethernet definitions.
  58. RUNT        equ    60        ;smallest legal size packet, no fcs
  59. GIANT        equ    1514        ;largest legal size packet, no fcs
  60. EADDR_LEN    equ    6        ;Ethernet address length.
  61.  
  62. ;The following two macros are used to manipulate port addresses.
  63. ;Use loadport to initialize dx.  Use setport to set a specific port on
  64. ;the board.  setport remembers what the current port number is, but beware!
  65. ;setport assumes that code is being executed in the same order as the
  66. ;code is presented in the source file.  Whenever this assumption is violated,
  67. ;you need to enter another loadport.  Some, but not all examples are:
  68. ;in a loop with multiple setports, or a backward jump over a setport, or
  69. ;a forward jump over a setport.  If you have any doubt, consult the
  70. ;individual driver sources for examples of usage.  If you suspect that
  71. ;you have too few loadports, define the symbol "no_confidence".  This will
  72. ;force a loadport before every setport.
  73. loadport    macro
  74.     mov    dx,io_addr
  75. port_no    =    0
  76.     endm
  77.  
  78. ;change the port number from the current value to the new value.
  79. setport    macro    new_port_no
  80.     ifdef    no_confidence        ;define if you suspect that you don't
  81.         loadport        ;  have enough loadports, i.e. dx is
  82.     endif                ;  set to the wrong port.
  83.     if    new_port_no - port_no EQ 1
  84.         inc    dx
  85.     else
  86.         if    new_port_no - port_no EQ -1
  87.             dec    dx
  88.         else
  89.             if    new_port_no - port_no NE 0
  90.                 add    dx,new_port_no - port_no
  91.             endif
  92.         endif
  93.     endif
  94. port_no    =    new_port_no
  95.     endm
  96.  
  97. segmoffs    struc
  98. offs        dw    ?
  99. segm        dw    ?
  100. segmoffs    ends
  101.